refactor(http): eliminate third-party httpx-sse dependency#1132
refactor(http): eliminate third-party httpx-sse dependency#1132Iwaniukooo11 wants to merge 5 commits into
Conversation
Replaced httpx-sse imports with a native Server-Sent Events (SSE) streaming parser in the client transport helpers. Refactored transport unit tests to mock standard HTTP response line streaming. Removed the httpx-sse dependency from pyproject.toml and uv.lock.
There was a problem hiding this comment.
Code Review
This pull request removes the external httpx-sse dependency and implements a custom Server-Sent Events (SSE) parser (parse_sse_stream) to process streaming HTTP responses directly. Corresponding test suites have been updated to mock httpx.Response.aiter_lines instead of EventSource. Feedback was provided on a potential bug in the custom parser where buffered event data could be lost if the stream terminates without a trailing empty line, along with a suggestion to handle empty event fields correctly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/http_helpers.py | 93.59% | 95.54% | 🟢 +1.95% |
| src/a2a/server/events/event_queue_v2.py | 91.71% | 91.19% | 🔴 -0.52% |
| src/a2a/utils/telemetry.py | 91.47% | 90.70% | 🔴 -0.78% |
| Total | 92.97% | 92.97% | ⚪️ 0.00% |
Generated by coverage-comment.yml
Summary
Removed the third-party dependency
httpx-sseto reduce the SDK's attack surface. Replaced it with a native, lightweight Server-Sent Events (SSE) streaming parser inside the HTTP transport helpers.Changes
httpx-ssefrompyproject.tomland updateduv.lock.EventSource.aiter_sse()with a localparse_sse_streamgenerator that parses streaming line blocks and yields typed event payloads.test_rest_client.pyandtest_jsonrpc_client.pyto mock standardResponseline streaming instead of the third-partyEventSourceobject.Verification
Ran tests and linters locally with
httpx-sseuninstalled:Status: 72 tests passed, linter green.